package game.engine.ia;

import java.util.ArrayList;
import java.util.List;

public abstract class AbstractState implements IState
{
	/** Liste des transitions */
	protected List<ITransition> _listTransition = null;;

	/** ref model */
	protected IModelFSM _model;

	public AbstractState()
	{
		_listTransition = new ArrayList<ITransition>();
	}

	@Override
	public void addTransition( ITransition pTransition )
	{
		_listTransition.add( pTransition );
	}

	public IState nextState( ICleverEntity pEntity )
	{
		for ( ITransition transition : _listTransition )
		{
			if ( transition.isValidTransition( pEntity ) )
			{
				return transition.getNextState();
			}
		}
		return null;
	}

}
